{set:
$regimentUser = new IModel('regiment_user_relation');
$seller_id = $this->seller['seller_id'];
}

<article class="module width_full">
	<header>
		<h3 class="tabs_involved">团购列表</h3>
		<ul class="tabs">
			<li><input type="button" class="alt_btn" onclick="window.location.href='{url:/seller/regiment_edit}';" value="添加团购" /></li>
			<li><input type="button" class="alt_btn" onclick="selectAll('id[]');" value="全选" /></li>
			<li><input type="button" class="alt_btn" onclick="delModel();" value="批量删除" /></li>
		</ul>
	</header>

	<form method='post' action='{url:/seller/regiment_del}'>
		<table class="tablesorter" cellspacing="0">
			<colgroup>
				<col width="40px" />
				<col />
				<col width="280px" />
				<col width="70px" />
				<col width="80px" />
				<col width="90px" />
				<col width="100px" />
			</colgroup>

			<thead>
				<tr>
					<th>选择</th>
					<th>标题</th>
					<th>团购时间</th>
					<th>排序</th>
					<th>状态</th>
					<th>销售情况</th>
					<th>操作</th>
				</tr>
			</thead>

			<tbody>
				{set:$page= (isset($_GET['page'])&&(intval($_GET['page'])>0))?intval($_GET['page']):1;}
				{query:name=regiment as re join=left join goods as go on go.id eq re.goods_id where=go.seller_id eq $seller_id fields=re.* order=re.sort asc page=$page}
				{set:
					$regUserRow=$regimentUser->getObj('is_over = 1 and regiment_id = '.$item['id'],'count(*) as sum_count');
					$item['sum_count'] = isset($regUserRow['sum_count']) ? $regUserRow['sum_count'] : 0;
				}
				<tr>
					<td><input type='checkbox' name='id[]' value='{$item['id']}' /></td>
					<td><a href='{url:/site/groupon/id/$item[id]}' target='_blank' class="orange" title="{$item['title']}">{$item['title']}</a></td>
					<td>{$item['start_time']} ～ {$item['end_time']}</td>
					<td>{$item['sort']}</td>
					<td>{echo:($item['is_close']==1) ? '关闭':'开启'}</td>
					<td>{$item['sum_count']}/{$item['store_nums']}</td>
					<td>
						<a href='{url:/seller/regiment_edit/id/$item[id]}'>
							<img src="{skin:images/main/icn_edit.png}" alt="修改" title="修改" />
						</a>

						<a href='javascript:void(0)' onclick="delModel({link:'{url:/seller/regiment_del/id/$item[id]}'});">
							<img src="{skin:images/main/icn_del.png}" alt="删除" title="删除" />
						</a>
					</td>
				</tr>
				{/query}
			</tbody>
		</table>
	</form>
</article>

{$query->getPageBar()}
